$(document).ready(function(){
	var form_id = $("#form_id").val();
	if(!form_id){
		getFormForWorkflow(function(data){
			var newDialog = new jDialog(data, "","", "", "", function(){});
			newDialog.themeDialog("modal2");
			//select form
			$(".getFormForWorkflow").click(function(){
				var value = $(".forms_selection").val();
				if (value!=0) {
					var user_view = $("#user_url_view").val();
					var pathname = window.location.pathname;
					if (pathname == user_view + "workflow") {
						window.location= user_view + "workflow?view_type=create&form_id="+value;
					}else{
						window.location= "/workflow?view_type=create&form_id="+value;
					}
					
					$("#popup_overlay,#popup_container").remove();
				}else{
					showNotification({
						message: "Please choose a form to proceed.",
						type: "error",
						autoClose: true,
						duration: 3
					});
				}
				
			})
		})
	}


	
})